import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import VueLazyload from 'vue-lazyload'
import axios from 'axios'
import Vant from 'vant';
import 'vant/lib/index.css';

Vue.use(Vant);

Vue.prototype.axios = axios

Vue.use(VueLazyload, {
  preLoad: 1.3,
  loading: require("@/assets/loading.gif"),
  attempt: 1
})

// 配置请求拦截响应拦截
axios.interceptors.request.use(function (config) {
  // 在发送请求之前做些什么
  store.state.isShowLoading = true
  return config;
});
// 添加响应拦截器
axios.interceptors.response.use(function (response) {
  // 2xx 范围内的状态码都会触发该函数。
  // 对响应数据做点什么
  store.state.isShowLoading = false
  return response;
});

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
